package com.tencent.wxcloudrun.vo.request.card;

import java.time.LocalDateTime;

import com.tencent.wxcloudrun.domain.TUserCardRecord;
import com.tencent.wxcloudrun.vo.BaseReqVo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @Author ZhaoZiYin
 * @Date 2025/4/22
 * @Description 使用卡片请求入参
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "UserCardUseReqVo", description = "使用卡片请求入参")
public class UserCardUseReqVo extends BaseReqVo {

    @NotNull
    @ApiModelProperty("卡片序号")
    private Long cardId;

    @NotNull
    @ApiModelProperty("活动序号")
    private Long actiId;

    @ApiModelProperty("申请描述")
    private String memo;

    public TUserCardRecord build() {
        TUserCardRecord record = new TUserCardRecord();
        record.setUserId(this.getUserId());
        record.setCardId(this.getCardId());
        record.setActiId(this.getActiId());
        record.setType(2);
        record.setCount(1);
        record.setMemo(this.getMemo());
        record.setCreatedBy(String.valueOf(this.getUserId()));
        record.setCreatedTime(LocalDateTime.now());
        record.setUpdatedBy(String.valueOf(this.getUserId()));
        record.setUpdatedTime(LocalDateTime.now());
        return record;
    }

}
